package cn.hy.rabbitmq;

import cn.hy.mq.MqSecKillMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class MQSender {
    @Resource
    private RabbitTemplate rabbitTemplate;
    public void sendSecKillMessage(MqSecKillMessage mqSecKillMessage) {
        log.info("send sec kill message:" + mqSecKillMessage);
        rabbitTemplate.convertAndSend("q.sec_kill", mqSecKillMessage);
    }
}
